<template>
    <view>
        <navigator
            class="UgobackFix"
            hoverClass="none"
            :openType="pages.length == 1 ? 'switchTab' : 'navigateBack'"
            :style="'top:' + nTop + 'px'"
            :url="pages.length == 1 ? '/pages/index/index4' : ''"
        >
            <view class="i ico">{{ pages.length == 1 ? '' : '' }}</view>
        </navigator>
        <view class="utop" :style="'background:url(' + PHOTO.photo_blur_url + ') top center / cover no-repeat'">
            <view class="photo_m">
                <image @tap="viewFn" :data-path_b="PHOTO.photo_b_url" mode="aspectFill" :src="PHOTO.photo_m_url"></image>
                <view :class="'parent' + D.parent_class">{{ D.parent_str }}</view>
            </view>
        </view>
        <view class="u_data hn_u">
            <view class="dl" v-for="(item, index) in U" :key="index">
                <view class="dt">{{ item.T }}</view>

                <view class="dd">
                    <image class="ugrade2" mode="aspectFill" :src="item.grade_ico" v-if="item.T == '用户等级'"></image>
                    {{ item.V }}
                    <text @tap.stop.prevent="copyuidFn" class="ico icon-copyuid" :data-uid="uid" v-if="item.T == '嘉宾编号'"></text>
                </view>
            </view>
        </view>
        <view class="u_data hn_u" :style="'margin-top:10px;padding-bottom:10px;--rgbcolor:' + rgbcolor + ';'" v-if="MATE.length > 0">
            <view class="h3">择偶要求</view>
            <view class="dl" v-for="(item, index) in MATE" :key="index">
                <view class="dt">{{ item.t }}</view>

                <view class="dd">{{ item.v }}</view>
            </view>
        </view>
        <view class="u_btm ifhx" :style="'--rgbcolor:' + rgbcolor + ';--color:' + color + ';'">
            <view @tap="hxFn" :class="'a' + (D.ifhxflag == 1 ? ' ed' : '')">
                <text class="ico">
                    <block v-if="D.ifhxflag == 1"> 已选择</block>
                    <block v-else> 选{{ D.sex_str }}</block>
                </text>
            </view>
            <view @tap="div_hn_btmFn" :class="'a' + (D.qxnum_ed_herme > 0 ? ' ed' : '')">
                <text class="ico">
                    <block v-if="D.qxnum_ed_herme > 0"> 已牵线</block>
                    <block v-else> 牵线</block>
                </text>
            </view>
        </view>
        <view @tap="backtopFn" class="backtop fadeInUp" data-id="index" :style="'color:' + color" v-if="backtop_flag">
            <text class="ico icon-backtop"></text>
            顶部
        </view>
        <view class="blank"></view>
        <!-- parse <include src="../login.wxml"></include> -->
        <block>
            <view class="mask3 alpha0_100" v-if="div_login">
                <view
                    class="div_box big_normal"
                    style="--div_box_width: 82%; --div_box_height: 666rpx; background: -webkit-linear-gradient(top, #fde9ee 1%, #fff 150%); background-color: #fff"
                >
                    <view class="m" :style="'border-color:rgba(' + rgbcolor + ',.2);'">
                        <image mode="aspectFit" src="/static/res/img/photo_m.png"></image>
                    </view>
                    <view class="S22 B">登录后获得更精准推荐</view>
                    <view class="loginagree">
                        <checkbox-group @change="ifagreeFn">
                            <label style="margin-left: -10rpx">
                                <checkbox :style="'--color:' + color + ';'" value="1"></checkbox>
                                <text class="C666 vmiddle">阅读并同意</text>
                            </label>
                        </checkbox-group>
                        <navigator class="vmiddle" hoverClass="none" :style="'color:' + color" url="/pagesA/about/law?kind=agreement">用户协议</navigator>
                        <text class="C666 vmiddle">与</text>
                        <navigator class="vmiddle" hoverClass="none" :style="'color:' + color + ';'" url="/pagesA/about/law?kind=declara">隐私条款</navigator>
                    </view>
                    <button
                        @getphonenumber="getPhoneNumber"
                        class="btn5 W90_"
                        openType="getPhoneNumber"
                        :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';width:73%'"
                        v-if="ifagree"
                    >
                        <text>手机号快捷登录</text>
                        <text :style="'color: ' + color + ';'">私密</text>
                    </button>
                    <button @tap="ifagree_passFn" class="btn5" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';width:73%'" v-else>
                        <text>手机号快捷登录</text>
                        <text :style="'color: ' + color + ';'">私密</text>
                    </button>
                    <view @tap="back" class="C666">
                        <text style="border-bottom: #999 1px solid">暂不登录</text>
                    </view>
                </view>
            </view>
        </block>
        <!-- parse <include src="../component/sorry.wxml"></include> -->
        <block>
            <view @tap="mask_closeFn" :class="'mask2 ' + mask_class" data-maskid="div_vip" v-if="div_vip">
                <view @tap.stop.prevent="emptyFn" class="div_box div_vip" :style="'--div_box_width:600rpx;--div_box_height:' + (div_vip_H > 0 ? div_vip_H : 480) + 'rpx;'">
                    <view @tap.stop.prevent="mask_closeFn" class="closebtm ico" data-maskid="div_vip"></view>
                    <view class="h1">{{ div_vip_title }}</view>
                    <text class="C S15" v-if="!WXS.empty(div_vip_content)">{{ div_vip_content }}</text>
                    <block v-else>
                        <view class="C S15">开通VIP超级会员，专享超值权益</view>
                        <view class="C S15">相亲成功率大大提升</view>
                    </block>
                    <view class="ico picico"></view>
                    <view @tap.stop.prevent="vipFn" class="btn_btm btn44 ico"> 立即开通</view>
                </view>
            </view>
            <view @tap="mask_closeFn" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_cert" v-if="div_cert">
                <view @tap.stop.prevent="emptyFn" class="div_box div_cert" style="--div_box_width: 600rpx; --div_box_height: 480rpx">
                    <view @tap.stop.prevent="mask_closeFn" class="closebtm ico" data-closekind="back" data-maskid="div_cert"></view>
                    <view class="h1">{{ div_cert_title }}</view>
                    <view class="C S15">成为认证用户，即享沟通特权</view>
                    <view class="C S15">提高诚信值，杜绝虚假</view>
                    <view class="ico picico"></view>
                    <view @tap.stop.prevent="certFn" class="btn_btm btn44 ico">立即认证</view>
                </view>
            </view>
            <view @tap="mask_closeFn" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_data" v-if="div_data">
                <view @tap.stop.prevent="emptyFn" class="div_box div_data" :style="'--div_box_width:600rpx;--div_box_height:490rpx;--color:' + color + ';--rgbcolor:' + rgbcolor">
                    <view @tap.stop.prevent="mask_closeFn" class="closebtm ico" data-closekind="back" data-maskid="div_data"></view>
                    <view class="h1">{{ div_data_title }}</view>
                    <view class="C S15">赶快去完善，解锁更多功能</view>
                    <view class="C S15">完成资料，上传头像，受关注度暴增</view>
                    <view class="C S15 Cf00">如果还未审核，请等待审核</view>
                    <view class="ico picico"></view>
                    <view @tap.stop.prevent="dataFn" class="btn_btm btn44 ico">立即完善</view>
                </view>
            </view>
            <view @tap="mask_closeFn" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_gps" v-if="div_gps">
                <view @tap.stop.prevent="emptyFn" class="div_box div_gps" :style="'--div_box_width:550rpx;--div_box_height:480rpx;--color:' + color + ';--rgbcolor:' + rgbcolor">
                    <view @tap.stop.prevent="mask_closeFn" class="closebtm ico" data-closekind="back" data-maskid="div_gps"></view>
                    <view class="h1">{{ div_gps_title }}</view>
                    <view class="C S15">授权后，将自动获取您当前位置</view>
                    <view class="C S15">否则将无法使用《附近的人》功能</view>
                    <view class="ico picico"></view>
                    <view @tap.stop.prevent="gpsFn" class="btn_btm btn44 ico">同意获取位置</view>
                </view>
            </view>
        </block>
        <!-- parse <include src="../component/div_hn_btm.wxml"></include> -->
        <block>
            <view @tap="div_hn_btm_closeFn" :class="'mask1 ' + mask_class" v-if="div_hn_btm">
                <view
                    @tap.stop.prevent="emptyFn"
                    :class="'div_bottom div_bottom_yuan ' + div_hn_btm_box_class"
                    :style="'--div_box_height:' + (HN.homekefuewm == 1 ? 500 : 740) + 'rpx;--color:' + color + ';--rgbcolor:' + rgbcolor"
                >
                    <view @tap.stop.prevent="div_hn_btm_closeFn" class="closert ico"></view>
                    <view class="div_hn_btm">
                        <block v-if="!WXS.empty(HN.hn_id) && HN.homekefuewm == 0">
                            <view class="dl">
                                <view class="dt">
                                    <view class="senduid">
                                        <image mode="aspectFill" :src="HN.cook_photo_m_url"></image>
                                        <text class="font">
                                            我
                                            <text class="span">ID：{{ HN.cook_uid }}</text>
                                        </text>
                                    </view>
                                    <view class="admid">
                                        <view class="em hnpic">
                                            <image mode="aspectFill" :src="HN.hn_path_s_url"></image>
                                            <text class="b">经纪人</text>
                                        </view>
                                        <text class="font">{{ HN.hn_truename }}</text>
                                    </view>
                                    <view class="uid">
                                        <image mode="aspectFill" :src="HN.photo_m_url"></image>
                                        <text class="font">
                                            <text class="span">ID：{{ HN.uid }}</text>
                                        </text>
                                    </view>
                                </view>
                                <view class="dd">
                                    <image mode="aspectFill" :showMenuByLongpress="true" :src="HN.hn_ewm_url"></image>
                                    <view class="C999 h6">长按二维码加经纪人微信</view>
                                    <navigator hoverClass="none" url="/myPages/hongniang/hongniang?currentTab=1">我的牵线记录({{ HN.cook_qxnum_ed }})</navigator>
                                </view>
                            </view>
                            <view @tap="div_hn_btm_qxFn" class="btn5 ico" :style="HN.cook_qxnum_ed_herme > 0 ? 'background:#f60' : ''">{{ HN.qxbtn_str }}</view>
                        </block>
                        <view class="homekefuewm" v-if="WXS.empty(HN.hn_id) || HN.homekefuewm == 1">
                            <image mode="aspectFill" :showMenuByLongpress="true" :src="HN.kf_ewm_url"></image>
                            <view class="font">长按二维码加客服微信</view>
                            <view @tap="telFn" class="em">
                                <text class="i ico"></text>
                                <view class="a">{{ HN.kf_tel }} (点击拔打)</view>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
        </block>
    </view>
</template>
<script module="WXS" lang="wxs" src="@/res/www.a9a.cn.wxs"></script>
<script>
var t;
var a = require('../../@babel/runtime/helpers/defineProperty');
var n = require('../../res/www.a9a.cn.js');
var app = getApp();
export default {
    data() {
        return {
            mask_class: 'alpha0_100',
            div_hn_btm_box_class: 'div_upAnm1',
            id: '',
            uid: '',
            ifhx: '',
            color: '',
            rgbcolor: '',
            backtop_flag: false,

            D: {
                parent_class: '',
                parent_str: '',
                ifhxflag: 0,
                sex_str: '',
                qxnum_ed_herme: 0
            },

            MATE: '',

            PHOTO: {
                photo_blur_url: '',
                photo_b_url: '',
                photo_m_url: ''
            },

            U: '',

            HN: {
                homekefuewm: 0,
                cook_photo_m_url: '',
                cook_uid: '',
                hn_path_s_url: '',
                hn_truename: '',
                photo_m_url: '',
                uid: '',
                hn_ewm_url: '',
                cook_qxnum_ed: '',
                cook_qxnum_ed_herme: 0,
                qxbtn_str: '',
                kf_ewm_url: '',
                kf_tel: ''
            },

            div_login: false,
            div_hn_btm: false,
            pages: [],
            nTop: '',
            ifagree: '',
            div_vip: '',
            div_vip_H: 0,
            div_vip_title: '',
            div_vip_content: '',
            div_cert: '',
            div_cert_title: '',
            div_data: '',
            div_data_title: '',
            div_gps: [],
            div_gps_title: ''
        };
    },
    onLoad: function (t) {
        var that = this;
        this.setData({
            id: t.id,
            uid: t.uid,
            ifhx: t.ifhx
        });
        app.globalData.get_config('_ZEAI').then(function (t) {
            that.setData({
                color: app.globalData._ZEAI.color,
                rgbcolor: n.c16_rgb(app.globalData._ZEAI.color)
            });
        });
        app.globalData.get_navigationBarTopHeight(this);
        app.globalData.get_openid().then(function (t) {
            that.init();
        });
    },
    onPageScroll: function (t) {
        t.scrollTop > 100
            ? this.setData({
                  backtop_flag: true
              })
            : this.setData({
                  backtop_flag: false
              });
    },
    methods: {
        init: function () {
            var that = this;
            (n.ifint(this.id) && n.ifint(this.uid)) ||
                uni.showModal({
                    content: '参数跑路了',
                    confirmColor: that.color,
                    confirmText: '朕知道了',
                    showCancel: false,
                    success: function (t) {
                        uni.navigateBack();
                    }
                });
            uni.showLoading({
                title: '拼命加载中...',
                mask: true
            });
            var o = {
                submitok: 'hn_u',
                openid: (t = uni.getStorageSync('COOK_U')).openid,
                id: this.id,
                uid: this.uid,
                ifhx: this.ifhx
            };
            app.globalData.ajax({
                url: 'huxuan.php',
                data: o,
                success: function (t) {
                    if (1 == t.flag) {
                        that.setData({
                            D: t.D,
                            MATE: t.MATE,
                            PHOTO: t.PHOTO,
                            U: t.U,
                            HN: t.HN
                        });
                    } else {
                        if ('nobm' == t.flag) {
                            uni.showModal({
                                content: t.msg,
                                confirmColor: that.color,
                                confirmText: '朕知道了',
                                showCancel: false,
                                success: function (t) {
                                    uni.redirectTo({
                                        url: '/hnPages/huxuan/huxuan_detail?id=' + that.id
                                    });
                                }
                            });
                        } else {
                            uni.showToast({
                                title: t.msg,
                                icon: 'none',
                                mask: true
                            });
                        }
                    }
                    uni.hideLoading();
                }
            });
        },

        hxFn: function () {
            var that = this;
            app.globalData.chklogin().then(function (o) {
                o
                    ? uni.showModal({
                          title: '',
                          content: '确定要选择' + that.D.sex_str + '？\r\n选择后将不能更换，请认真对待',
                          confirmColor: that.color,
                          cancelText: '我再想想',
                          confirmText: '确定',
                          success: function (o) {
                              if (o.confirm) {
                                  uni.showLoading({
                                      title: '玩命加载中',
                                      mask: true
                                  });
                                  app.globalData.ajax({
                                      url: 'huxuan.php',
                                      data: {
                                          submitok: 'hx_add',
                                          openid: t.openid,
                                          id: that.id,
                                          uid: that.uid,
                                          ifhx: that.ifhx
                                      },
                                      success: function (t) {
                                          1 == t.flag
                                              ? uni.showModal({
                                                    content: t.msg,
                                                    confirmColor: that.color,
                                                    confirmText: '朕知道了',
                                                    showCancel: false,
                                                    success: function (t) {
                                                        uni.navigateBack();
                                                    }
                                                })
                                              : 0 == t.flag
                                              ? uni.showModal({
                                                    content: t.msg,
                                                    confirmColor: that.color,
                                                    confirmText: '朕知道了',
                                                    showCancel: false,
                                                    success: function (t) {}
                                                })
                                              : ((t.this = that), (t.url = 'no'), n.sorry(t));
                                          uni.hideLoading();
                                      }
                                  });
                              }
                          }
                      })
                    : (that.setData({
                          div_login: true
                      }),
                      uni.hideLoading());
            });
        },

        mask_closeFn: function (t) {
            var that = this;
            var i = t.currentTarget.dataset.maskid;
            this.setData({
                mask_class: 'alpha100_0',
                div_hn_btm_box_class: 'div_upAnm2'
            });
            setTimeout(function () {
                var t;
                that.setData((a((t = {}), i, false), a(t, 'mask_class', 'alpha0_100'), a(t, 'div_hn_btm_box_class', 'div_upAnm1'), t));
            }, 500);
        },

        div_hn_btm_closeFn: function () {
            var that = this;
            this.setData({
                mask_class: 'alpha100_0',
                div_hn_btm_box_class: 'div_upAnm2'
            });
            setTimeout(function () {
                that.setData({
                    div_hn_btm: false,
                    mask_class: 'alpha0_100',
                    div_hn_btm_box_class: 'div_upAnm1'
                });
            }, 500);
        },

        emptyFn: function () {},

        div_hn_btmFn: function () {
            this.setData({
                div_hn_btm: true
            });
        },

        div_hn_btm_qxFn: function () {
            var that = this;
            var o = this.HN.qx_1price_str;
            o = app.globalData.empty(o) ? '' : '\r\n' + o;
            uni.showModal({
                title: '',
                content: '确定委托【' + that.HN.hn_truename + '】牵线么？' + o,
                confirmColor: that.color,
                cancelText: '我再想想',
                confirmText: '确定',
                success: function (o) {
                    if (o.confirm) {
                        app.globalData.ajax({
                            url: 'huxuan.php',
                            data: {
                                submitok: 'div_hn_btm_qx',
                                openid: t.openid,
                                id: that.id,
                                uid: that.uid,
                                ifhx: that.ifhx,
                                admid: that.HN.hn_id
                            },
                            success: function (t) {
                                1 == t.flag
                                    ? uni.showModal({
                                          content: t.msg,
                                          confirmColor: that.color,
                                          confirmText: '朕知道了',
                                          showCancel: false,
                                          success: function (t) {
                                              uni.navigateBack();
                                          }
                                      })
                                    : 'qx_1price' == t.flag
                                    ? app.globalData.pay({
                                          data: {
                                              submitok: 'qx_1price',
                                              qx_admid: that.HN.hn_id,
                                              qx_uid: that.uid
                                          },
                                          success: function (t) {
                                              uni.showToast({
                                                  title: t.msg,
                                                  mask: true,
                                                  duration: 3000
                                              });
                                              setTimeout(function () {
                                                  that.init();
                                              }, 3000);
                                          },
                                          fail: function (t) {
                                              t.this = that;
                                              t.url = 'no';
                                              n.sorry(t);
                                          }
                                      })
                                    : 0 == t.flag
                                    ? uni.showModal({
                                          content: t.msg,
                                          confirmColor: that.color,
                                          confirmText: '朕知道了',
                                          showCancel: false,
                                          success: function (t) {}
                                      })
                                    : ((t.this = that), (t.url = 'no'), n.sorry(t));
                            }
                        });
                    }
                }
            });
        },

        telFn: function (t) {
            uni.makePhoneCall({
                phoneNumber: this.HN.kf_tel
            });
        },

        vipFn: function () {
            var that = this;
            app.globalData.chklogin().then(function (a) {
                a
                    ? uni.navigateTo({
                          url: '/pagesA/my_vip/my_vip'
                      })
                    : that.setData({
                          div_login: true
                      });
            });
        },

        certFn: function () {
            var that = this;
            app.globalData.chklogin().then(function (a) {
                a
                    ? uni.navigateTo({
                          url: '/myPages/cert/cert'
                      })
                    : that.setData({
                          div_login: true
                      });
            });
        },

        dataFn: function () {
            var that = this;
            app.globalData.chklogin().then(function (a) {
                a
                    ? uni.navigateTo({
                          url: '/pagesA/reg/reg'
                      })
                    : that.setData({
                          div_login: true
                      });
            });
        },

        getPhoneNumber: function (t) {
            app.globalData.getPhoneNumber({
                e: t,
                url: '/pagesA/reg/reg',
                urlkind: 'navigateTo'
            });
        },

        copyuidFn: function (t) {
            var a = t.currentTarget.dataset.uid;
            n.copy_text({
                data: a,
                msg: 'ID编号复制成功'
            });
        },

        viewFn: function (t) {
            var a = t.currentTarget.dataset.path_b;
            n.empty(a) ||
                uni.previewImage({
                    current: a,
                    urls: [a]
                });
        },

        backtopFn: function () {
            uni.pageScrollTo({
                scrollTop: 0
            });
        },

        ifagreeFn() {
            console.log('占位：函数 ifagreeFn 未声明');
        },

        ifagree_passFn() {
            console.log('占位：函数 ifagree_passFn 未声明');
        },

        back() {
            console.log('占位：函数 back 未声明');
        },

        gpsFn() {
            console.log('占位：函数 gpsFn 未声明');
        }
    }
};
</script>
<style>
@import 'hn_u.css';
</style>
